package com.zrsx.searchmodel.controller;

import com.zrsx.searchmodel.common.result.Result;
import com.zrsx.searchmodel.common.vo.CountVO;
import com.zrsx.searchmodel.service.CountService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/credit/count")
@Slf4j
@Tag(name = "行为统计")
public class CountController {
    @Autowired
    private CountService countService;

    /**
     * 获取用户行为统计信息
     * @param userId
     * @return
     */
    @GetMapping("/{userId}")
    @Operation(summary = "获取用户行为统计信息")
    public Result<CountVO> getCount(@PathVariable Integer userId){
        log.info("行为统计信息接收userId:{}",userId);
        CountVO countVO = countService.getCount(userId);
        return Result.success(countVO);
    }
}
